package org.apache.dolphinscheduler.api.controller;

import org.apache.dolphinscheduler.api.service.ResourceApplyService;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.dao.entity.ResourceApply;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.ApiOperation;

/**
 * <p>
 * 超算资源申请表 前端控制器
 * </p>
 *
 * @author denggh
 * @since 2023-10-18
 */
@RestController
@RequestMapping("/resource/apply")
public class ResourceApplyController extends BaseController {

    @Autowired
    private ResourceApplyService resourceApplyService;

    /**
     * 新增申请
     */
    @PostMapping
    @ApiOperation("新增申请")
    public Result add(@Validated @RequestBody ResourceApply resourceApply) {

        Map<String, Object> result = resourceApplyService.insertResourceApply(resourceApply);
        return returnDataList(result);
    }
}
